#ifndef CONNECTIONWINDOW_H
#define CONNECTIONWINDOW_H

#include <QDialog>
#include <QListWidget>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QSqlDatabase>

class ConnectionManager;
struct ConnectionConfig;

class ConnectionWindow : public QDialog
{
    Q_OBJECT

public:
    explicit ConnectionWindow(ConnectionManager *manager, QWidget *parent = nullptr);
    
    QString getSelectedConnection() const;

private slots:
    void addConnection();
    void editConnection();
    void removeConnection();
    void connectToSelected();
    void selectionChanged();
    void doubleClicked(QListWidgetItem *item);

private:
    void setupUI();
    void loadConnections();
    void updateConnectionList();
    
    ConnectionManager *m_connectionManager;
    QListWidget *m_connectionList;
    QPushButton *m_addButton;
    QPushButton *m_editButton;
    QPushButton *m_removeButton;
    QPushButton *m_connectButton;
    QDialogButtonBox *m_buttonBox;
    
    QString m_selectedConnection;
};

#endif // CONNECTIONWINDOW_H